<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> 
        <meta name="apple-mobile-web-app-capable" content="yes">
        <link rel="shortcut icon" type="image/x-icon" href="{{URL::asset('handan/images/logo-icon.png')}}" />
        <link rel="stylesheet" href="{{URL::asset('newmobile/css/public.css') }}"/>
        <link rel="stylesheet" href="{{URL::asset('newmobile/css/analyst.css') }}"/>
        <title>反向榜</title>
        <script src="{{URL::asset('public_js/jquery-3.2.1.min.js')}}"></script>
        <script src="{{URL::asset('newmobile/js/public.js') }}"></script>
        <script src="{{URL::asset('newmobile/js/analyst.js') }}"></script>
    </head>
<body>
    

    <div class="l_btn_tab">
            <!-- 总收益曲线图 -->
            @include('newmobile.profitchart')
            <!--tab内容-->
            <div class="l_list_con">
                <div class="l_list l_list_show">
                    <ul>
                        <li>
                            <!--交易大导航-->
                            <div class="l_master_nav">
                                <div class="l_left_nav">
                                    反向榜
                                </div>
                                <div class="l_right_nav" onclick="rightNav();">
                                    <span>变更榜单</span>
                                    <span><img src="{{URL::asset('newmobile/images/new_analyst/replace_btn.png') }}" alt=""></span>
                                </div>
                            </div>                          
                            <!--筛选列表-->
                            <section class="filter2">
                                <ul>
                                    <li onclick="window.location.href='{{url("/")}}'">
                                        <span class="img">
                                            <img src="{{URL::asset('newmobile/images/new_icon/qianlibang-hui.png') }}" alt="">
                                        </span>
                                        <span class="txt">潜力榜</span>
                                    </li>
                                    <li onclick="window.location.href='{{url("/lianshengbang")}}'">
                                        <span class="img">
                                            <img src="{{URL::asset('newmobile/images/new_icon/lianshengbang-hui.png') }}" alt="">
                                        </span>
                                        <span class="txt">连胜榜</span>
                                    </li>
                                    <!-- <li onclick="window.location.href='{{url("/duanweibang")}}'">
                                        <span class="img">
                                            <img src="{{URL::asset('newmobile/images/new_icon/duanwei-hui.png') }}" alt="">
                                        </span>
                                        <span class="txt">段位榜</span>
                                    </li> -->
                                    <li onclick="window.location.href='{{url("/wendingzhishu")}}'">
                                        <span class="img">
                                            <img src="{{URL::asset('newmobile/images/new_icon/wendingzhishu-hui.png') }}" alt="">
                                        </span>
                                        <span class="txt">稳定指数</span>
                                    </li>
                                    <li onclick="window.location.href='{{url("/fengbaobi")}}'">
                                        <span class="img">
                                            <img src="{{URL::asset('newmobile/images/new_icon/fengbaobi-hui.png') }}" alt="">
                                        </span>
                                        <span class="txt">风报比</span>
                                    </li>
                                    <li onclick="window.location.href='{{url("/shenglvbang")}}'">
                                        <span class="img">
                                            <img src="{{URL::asset('newmobile/images/new_icon/shenglv-hui.png') }}" alt="">
                                        </span>
                                        <span class="txt">胜率榜</span>
                                    </li>
                                    <li class="active" onclick="window.location.href='{{url("/fanxiangbang")}}'">
                                        <span class="img">
                                            <img src="{{URL::asset('newmobile/images/new_icon/fanxiang.png') }}" alt="">
                                        </span>
                                        <span class="txt">反向榜</span>
                                    </li>
                                    <li onclick="window.location.href='{{url("/tuijianbang")}}'">
                                        <span class="img">
                                            <img src="{{URL::asset('newmobile/images/new_icon/fanxiang-hui.png') }}" alt="">
                                        </span>
                                        <span class="txt">推荐榜</span>
                                    </li>
                                </ul>
                            </section>
                            <!--区域-->
                            @foreach ($list as $key=>$val)
                            <section>
                                <div class="l_master_title">
                                    <section onclick="kaiDetails(this);">
                                    <!--头像-->
                                        <div class="photo" onclick="mastercenter('{{$val->id}}',event);">
                                            <div><img src="@if($val->photo) {{ $val->photo}} @else {{ URL::asset('ucenter/images/head.png')}} @endif" alt="" /></div>
                                        </div>
                                    <!--用户名-->
                                        <div class="uname">
                                            <div class="name">{{$val->username}}</div>
                                            <div class="img">
                                                <span>
                                                    <img src="@if($val->authstatus == 2) {{ URL::asset('newmobile/images/new_analyst/r_master.png') }} @else {{ URL::asset('newmobile/images/new_analyst/t_star.png') }} @endif" alt="">
                                                </span>
                                                <span>
                                                    @if($val->authstatus == 2)
                                                        认证大师
                                                    @else
                                                        明日之星
                                                    @endif
                                                </span>
                                            </div>
                                        </div>
                                    <!--段位-->
                                        <div class="dan">
                                            <div class="danInfo">
                                                <p>{{round($val->week_final_point,2)}}</p>
                                                <p>回撤点位</p>
                                            </div>
                                        </div>

                                    </section>
                                    @if($val->id == session('eai')['id'])
                                            <!--我看我自己-->
                                    @elseif($val->status == 1) <!--已订阅-->
                                        <button style="background-color: #4F5660;" onclick="gendan(this);" analyst_id="{{$val->id}}" analyst_username="{{$val->username}}" status="{{$val->status}}" direction="{{$val->direction}}">编辑</button>
                                    @else
                                        <button onclick="gendan(this);" analyst_id="{{$val->id}}" analyst_username="{{$val->username}}" status="3" direction="3">订阅</button>
                                    @endif
                                </div>
                                <div class="l_master_detail new_master_detail" style="background: #161a21;">
                                    <div class="detail new_detail" style="height: 3.625rem;">
                                        <!--图表-->
                                        <div class="l_left_chart">
                                            <div class='mChart' id='{{$val->username}}' style="width: 3.923rem; height: 3.092rem;"></div>
                                            <script>
                                                // 图表数据
                                                var x_chart_time  = '{{$val->timesstr}}';
                                                var x_chart_point = '{{$val->pointstr}}';
                                                x_chart_point     = x_chart_point.split(',');
                                                var x_chart_data  = [];
                                                x_chart_point.forEach(function(data,index,arr){
                                                    x_chart_data.push(+data);
                                                });
                                                profit('{{$val->username}}',[x_chart_time.split(','),x_chart_data]);
                                                // 图表数据
                                                function profit(id,data){
                                                    var t = this;
                                                    return new Highcharts.Chart({
                                                        chart: {
                                                            renderTo: id,
                                                            type: "areaspline",
                                                            zoomType: "xy",
                                                            backgroundColor: '#171922'
                                                        },
                                                        title: {
                                                            text : null
                                                        },
                                                        subtitle: {
                                                            text: null,
                                                            align: 'left',
                                                            verticalAlign: 'bottom'
                                                        },
                                                        colors: ["#ffc766"],
                                                        legend: {
                                                            enabled: false
                                                        },
                                                        credits: {
                                                            enabled: false
                                                        },
                                                        exporting: {
                                                            enabled:false
                                                        },
                                                        xAxis: {
                                                            lineWidth: 0, //去掉坐标轴
                                                            gridLineWidth: 0,
                                                            tickLength: 0, // 去掉坐标轴刻度线
                                                            categories:data[0],
                                                            labels: {
                                                                enabled: !1
                                                            }
                                                        },
                                                        yAxis: {
                                                            gridLineWidth: 0,
                                                            labels: {// 去掉Y轴
                                                                enabled: !1
                                                            },
                                                            title: {
                                                                text: null
                                                            }
                                                        },
                                                        tooltip: {
                                                            style: {
                                                                color: "white"
                                                            },
                                                            enabled : false, // 是否启用提示框， 默认启用
                                                            borderWidth: 1,
                                                            shadow: !1,
                                                            shared: !0,
                                                            backgroundColor: 'rgba(0,0,0)',   // 背景颜色
                                                            borderColor: '#e99d32',       // 边框颜色
                                                            formatter : function (){ // 提示框格式化字符串
                                                                var s;
                                                                $.each(this.points ,function(){
                                                                    s = '<b>总收入: ' + this.y+'点'+'</b><br/>';
                                                                });
                                                                s += '<b>截止: '+this.x+'</b>';
                                                                return s;
                                                            }
                                                        },
                                                        plotOptions: {
                                                            areaspline: {
                                                                fillColor: {
                                                                    linearGradient: {
                                                                        x1: 0,
                                                                        y1: 0,
                                                                        x2: 0,
                                                                        y2: 1
                                                                    },
                                                                    stops: [
                                                                        [0, "#171922"],
                                                                        [1, Highcharts.Color("#171922" , "#171922").setOpacity(0).get('rgba')]
                                                                    ]
                                                                },
                                                                marker: {
                                                                    radius: 0,
                                                                    fillColor: "white",
                                                                    lineWidth: 1,
                                                                    lineColor: "#ffc766"
                                                                },
                                                                lineWidth: 1,
                                                                states: {
                                                                    hover: {
                                                                        lineWidth: 1
                                                                    }
                                                                },
                                                                threshold: null
                                                            },
                                                            series: {
                                                                lineColor: "#e99d32"
                                                            }
                                                        },
                                                        series: [{
                                                            name: "盈利点位",
                                                            data: data[1]
                                                        }]
                                                    })
                                                }
                                            </script>
                                        </div>
                                        
                                        <div class="l_right_data">
                                            <div>
                                                <p class="num">{{round($val->single_final_point,2)}}</p>
                                                <p class="txt">单均回撤</p>
                                            </div>
                                            <div>
                                                <p class="num">{{round($val->ordernum,2)}}</p>
                                                <p class="txt">回撤单量</p>
                                            </div>
                                            <div class="clickDetail" onclick="weekRank({{(($list->currentPage()-1)*10)+$key+1}},{{$val->id}},event);" style="cursor: pointer;">详情</div>
                                        </div>
                                    </div>
                                </div>
                            </section>
                            @endforeach
                        </li>                                   
                    </ul>
                </div>
                <!-- 分页 -->
                <div  class="pagediv" style="text-align: center;">
                    @if($list->currentPage() != 1 && $list->currentPage() != 0)
                        <a href="javascript:void(0)" onclick='gotopage(0)' style="background-color:#3b9ce0">上一页</a>
                    @else
                        <a href="javascript:void(0)" style="background-color:#c2c4c9">上一页</a>
                    @endif
                        <span style="color:#3b9ce0">{{ $list->currentPage() }}</span>

                    @if($list->currentPage() != $list->lastPage() && $list->currentPage()<$list->lastPage())
                        <a href="javascript:void(0)"  onclick='gotopage(1)' style="background-color:#3b9ce0">下一页</a>
                    @else
                        <a href="javascript:void(0)" style="background-color:#c2c4c9">下一页</a>
                    @endif
                    <!-- <span>共  {{$list->total()}} 条记录</span>
                    <span>共 {{ $list->lastPage() }} 页</span> -->
                </div>
            </div>
            <!--订阅按钮弹层-->
            <div class="follow_btn" id="follow_btn">
                <div>
                    <div class="bor">
                        <span myAttr = '0' class=""></span>
                    </div>
                    正向订阅
                </div>
                <div></div>
                <div>
                    <div class="bor">
                        <span myAttr = '1' class=""></span>
                    </div>
                    反向订阅
                </div>
                <div>
                    <div class="squar">
                       <input type="checkbox" value="None" id="squar" name="check" />
                       <label for="squar" id="squar">
                            <span></span>
                       </label>
                    </div>
                    <span>我已阅读并同意<a href="{{url('/agree')}}">《订阅协议》</a></span>
                </div>
                <div>
                    <span onclick="cancle();">取消</span>
                    <span onclick="sure(this);">确定</span>
                </div>
                <!--取消订阅-->
                <div class="cancel_follow" id="gendancancle" onclick="follow(0,0,this);">
                    取消订阅
                </div>
            </div>
    </div>
<div style="height: 9rem;"></div>
@include('newmobile.footer')
@include('mobile.msg')
</body>
</html> 
<style>
    /*底部行情应用样式*/
    footer ul li:nth-child(1) a {
        color: #3B9CE0;
    }
    footer ul li:nth-child(1) a i {
        background: url("{{URL::asset('mobile/image/fxs_icond.png')}}") no-repeat center / cover;
    }
    /* 隐藏的区域 */
    body .l_btn_tab .l_list_con .l_list li section .new_master_detail div.new_detail .l_left_chart {
      margin-left: 0;
    }
    body .l_btn_tab .l_list_con .l_list li section .l_master_detail div.detail {
      padding-right: 0;
    }
    body .l_btn_tab .l_list_con .l_list li section .new_master_detail div.new_detail > div.l_right_data {
        display:-webkit-box;
        display: -moz-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: space-around;
    }
    body .l_btn_tab .l_list_con .l_list li section .new_master_detail div.new_detail > div.l_right_data > div {
      width: auto;
      text-align: center;
    }
     /* 详情按钮 */
    body .l_btn_tab .l_list_con .l_list li section .new_master_detail div.new_detail > div.l_right_data > div.clickDetail {
        width: 2.132rem;
        height: 1.066rem;
        border: 0.021rem solid #7390ae;
        border-radius: 8px;
        text-align: center;
        line-height: 1.066rem;
        font-size: 0.597rem;
        color: #7390ae;
    }
</style>
<script>
    var bdlists = "{{ url('/bdlists') }}";
    var aid       = 0;
    var analyst_username = '';
    var gotofllow = "{{url('/fllow')}}";
    var status    = 3;//是否订阅
    var direction = 3;//订阅方向
    var gotologin = "{{url('/mlogin')}}";
    //订阅按钮
    function gendan(obj) {
        $(obj).removeAttr("onclick");
        var islogin = "<?php echo Session('eai')['tel']?>";
        if(!islogin){
            //用户未登录
            msg('请先登录');
            setTimeout(function(){
                window.location.href = gotologin;
            },2000)
            return false;
        }
        var infofinish = '{{$infofinish}}';
        if(infofinish == 1){
            var gowanshan = "{{url('/authenticate?id=info')}}";
            $('.popUp').hide();
            msg('请完善资料');
            window.setTimeout(window.location.reload(),2000);
            return false;
        }else{
            $('.follow_btn').show();
            aid              = $(obj).attr('analyst_id');
            analyst_username = $(obj).attr('analyst_username');
            status           = $(obj).attr('status');
            direction        = $(obj).attr('direction');
            var button_html = $('.l_master_title button').html();
            if(button_html == "订阅") {
                var cancleBtn=$(".foot_right>input");
                cancleBtn.css({"visibility":"hidden"});
            }
            if(button_html == "编辑") {
                var thisBtn=this;
            }
            if(status == 1){
                $('#gendancancle').show();
                $('.follow_btn').attr('id','follow_btn_cancel');
            }else{
                $('#gendancancle').hide();
            }
        }
    }
    //去交易大师中心
    function mastercenter(userid,event){
        //取消事件冒泡
        var e=arguments.callee.caller.arguments[0]||event;
        if (e && e.stopPropagation) {
            e.stopPropagation();
        } else if (window.event) {
            window.event.cancelBubble = true;
        }
        var gomastercenter   = "{{url('/mastercenter')}}";
        window.location.href = gomastercenter+'?analyst_id='+userid;
    }
    // 分页
    function gotopage(types){
        var page = "{{$list->currentPage()}}" ;
        if(types == 0) {
            page = page == 1?page:(Number(page)-Number(1));
        }else{
            var lastpage = "{{$list->lastPage()}}";
            page = page == lastpage?page:(Number(page)+Number(1));
        }
        window.location.href = "{{ URL('/fanxiangbang?page=') }}"+page;
    }
</script>

